var msgs = ["Hello!","不要撩人家啦~~"];
$(document).ready(function(){
   var now = (new Date()).getHours();
        if (now <= 5) {
            text ="你是夜猫子呀？这么晚还不睡觉，明天起的来嘛？";
        } else if (now > 5 && now <= 8) {
            text = "早上好！一日之计在于晨，美好的一天就要开始了！";
        } else if (now > 8 && now <= 12) {
            text = "上午好！工作顺利嘛，不要久坐，多起来走动走动哦！";
        } else if (now > 12 && now <= 14) {
            text = "中午了，工作了一个上午，现在是午餐时间！";
        } else if (now > 14 && now <= 18) {
            text = "午后很容易犯困呢，今天的运动目标完成了吗？";
        } else if (now > 18 && now <= 20) {
            text = "傍晚了！窗外夕阳的景色很美丽呢，最美不过夕阳红~~";
        } else if (now > 20 && now <= 22) {
            text = "晚上好，今天过得怎么样？";
        } else if (now > 22 && now <= 24) {
            text = "已经这么晚了呀，早点休息吧，晚安~~";
        } else {
            text = "嗨~ 快来逗我玩吧！";
        }
        msgs[0] = text;
});

function showMessage(a,b){
    if(b==null) b = 10000;
    jQuery(".live2d_message").hide().stop();
    jQuery(".live2d_message").html(a);
    jQuery(".live2d_message").fadeTo("10",1);
    jQuery(".live2d_message").fadeOut(b);
}

$("#live2d_lord").mouseover(function(){
    var i = Math.floor(Math.random()*msgs.length);
    showMessage(msgs[i]);
});

$(document).on('copy', function (){
    showMessage("你都复制了些什么呀，转载要记得加上出处哦~~", 5000);
});

window.setInterval(showHitokoto,30000);
function showHitokoto(){
    $.getJSON('https://sslapi.hitokoto.cn/',function(result){
        showMessage(result.hitokoto, 5000);
    });
}

const loadScript = function loadScript(c,b){var a=document.createElement("script");a.type="text/javascript";"undefined"!=typeof b&&(a.readyState?a.onreadystatechange=function(){if("loaded"==a.readyState||"complete"==a.readyState)a.onreadystatechange=null,b()}:a.onload=function(){b()});a.src=c;document.body.appendChild(a)};
(function(){
if((typeof(device) != 'undefined') && (device.mobile())){
    document.getElementById("live2d").style.width = '75px';
    document.getElementById("live2d").style.height = '150px';
    }else if (typeof(device) === 'undefined') console.error('Cannot find current-device script.');
loadScript("./script.js", function(){loadlive2d("live2d", "./hijiki.model.json", 0.5);});
})();